package com.fmenu.system.service.impl;

import java.util.List;
import com.fmenu.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fmenu.system.mapper.BnsAccessoryMapper;
import com.fmenu.system.domain.BnsAccessory;
import com.fmenu.system.service.IBnsAccessoryService;

/**
 * 配料Service业务层处理
 * 
 * @author zhangrui
 * @date 2021-12-22
 */
@Service
public class BnsAccessoryServiceImpl implements IBnsAccessoryService 
{
    @Autowired
    private BnsAccessoryMapper bnsAccessoryMapper;

    /**
     * 查询配料
     * 
     * @param accessoryId 配料主键
     * @return 配料
     */
    @Override
    public BnsAccessory selectBnsAccessoryByAccessoryId(Long accessoryId)
    {
        return bnsAccessoryMapper.selectBnsAccessoryByAccessoryId(accessoryId);
    }

    /**
     * 查询配料列表
     * 
     * @param bnsAccessory 配料
     * @return 配料
     */
    @Override
    public List<BnsAccessory> selectBnsAccessoryList(BnsAccessory bnsAccessory)
    {
        return bnsAccessoryMapper.selectBnsAccessoryList(bnsAccessory);
    }

    /**
     * 新增配料
     * 
     * @param bnsAccessory 配料
     * @return 结果
     */
    @Override
    public int insertBnsAccessory(BnsAccessory bnsAccessory)
    {
        bnsAccessory.setCreateTime(DateUtils.getNowDate());
        return bnsAccessoryMapper.insertBnsAccessory(bnsAccessory);
    }

    /**
     * 修改配料
     * 
     * @param bnsAccessory 配料
     * @return 结果
     */
    @Override
    public int updateBnsAccessory(BnsAccessory bnsAccessory)
    {
        bnsAccessory.setUpdateTime(DateUtils.getNowDate());
        return bnsAccessoryMapper.updateBnsAccessory(bnsAccessory);
    }

    /**
     * 批量删除配料
     * 
     * @param accessoryIds 需要删除的配料主键
     * @return 结果
     */
    @Override
    public int deleteBnsAccessoryByAccessoryIds(Long[] accessoryIds)
    {
        return bnsAccessoryMapper.deleteBnsAccessoryByAccessoryIds(accessoryIds);
    }

    /**
     * 删除配料信息
     * 
     * @param accessoryId 配料主键
     * @return 结果
     */
    @Override
    public int deleteBnsAccessoryByAccessoryId(Long accessoryId)
    {
        return bnsAccessoryMapper.deleteBnsAccessoryByAccessoryId(accessoryId);
    }
}
